package handlers;

import model.Address;
import model.Person;
import model.PhoneNumber;

import javax.ejb.Local;
import java.util.List;

@Local
public interface PersonServiceHandler {

    Person addPerson(Person person);

    Person findPerson(Long id);

    Person alterPerson(Person person);

    void removePerson(Long id);

    Address addAddress(Address address);

    Address findAddress(Long id);

    List<Address> findAddressByInfo(Address address);

    Address alterAddress(Address address);

    void removeAddress(Long id);

    PhoneNumber addPhoneNumber(PhoneNumber phoneNumber, Person person);

    PhoneNumber findPhoneNumber(Long id);

    PhoneNumber alterPhoneNumber(PhoneNumber phoneNumber);

    void removePhoneNumber(Long id);

    List<Person> getAllPersons();

    List<Address> getAllAddresses();

    List<PhoneNumber> getAllPhoneNumbers();

    Person addCompletePerson(Person person, List<Address> addresses, List<PhoneNumber> phoneNumbers);

    void linkAddress(Person person, Address address);

    void detachAddress(Person person, Address address);

    boolean ensureUniqueMail(String mail);

    boolean ensureUniquePhone(PhoneNumber phoneNumber);

    boolean isOrphanAddress(Address address);

}
